From 8276bd265bb5440690e58876901c8c70a4f446a6 Mon Sep 17 00:00:00 2001
From: Aaron Barany <akb825@gmail.com>
Date: Sat, 27 Aug 2022 14:21:47 -0700
Subject: LanguageClient: Adjust restart limits

Changed restart timer to 2 minutes and max restarts to 5 for restarting
language client after it exits unexpectedly. This avoids disabling the
language client with clangd 14 in situations where it's likely to crash
during normal editing.

Change-Id: I333bb9d67ed1dbba2b52a1cd916f5d1cf3c0b60b
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
---
 src/plugins/languageclient/client.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/plugins/languageclient/client.cpp b/src/plugins/languageclient/client.cpp
index c86462bee4..49778d8f79 100644
--- a/src/plugins/languageclient/client.cpp
+++ b/src/plugins/languageclient/client.cpp
@@ -177,7 +177,7 @@ public:
         });
 
         m_restartCountResetTimer.setSingleShot(true);
-        m_restartCountResetTimer.setInterval(5 * 60 * 1000);
+        m_restartCountResetTimer.setInterval(2 * 60 * 1000);
         connect(&m_restartCountResetTimer, &QTimer::timeout,
                 this, [this] { m_restartsLeft = MaxRestarts; });
     }
@@ -301,7 +301,7 @@ public:
     AssistProviders m_clientProviders;
     QMap<TextEditor::TextDocument *, AssistProviders> m_resetAssistProvider;
     QHash<TextEditor::TextEditorWidget *, LanguageServerProtocol::MessageId> m_highlightRequests;
-    static const int MaxRestarts = 2;
+    static const int MaxRestarts = 5;
     int m_restartsLeft = MaxRestarts;
     QTimer m_restartCountResetTimer;
     InterfaceController *m_clientInterface = nullptr;
-- 
cgit v1.2.1

